package cn.mcartoon.serviceImpl;
import cn.mcartoon.mapper.MmCartoonClassificationDicMapper;
import cn.mcartoon.pojo.MmCartoonClassificationDic;
import cn.mcartoon.service.MmCartoonClassificationDicService;
import cn.mcartoon.dto.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
@Service
public class MmCartoonClassificationDicServiceImpl implements MmCartoonClassificationDicService {

    @Autowired
    private MmCartoonClassificationDicMapper mmCartoonClassificationDicMapper;

    public MmCartoonClassificationDic getMmCartoonClassificationDicById(Long id){
        return mmCartoonClassificationDicMapper.getMmCartoonClassificationDicById(id);
    }

    public List<MmCartoonClassificationDic>	getMmCartoonClassificationDicListByMap(Map<String,Object> param){
        return mmCartoonClassificationDicMapper.getMmCartoonClassificationDicListByMap(param);
    }

    public Integer getMmCartoonClassificationDicCountByMap(Map<String,Object> param){
        return mmCartoonClassificationDicMapper.getMmCartoonClassificationDicCountByMap(param);
    }

    public Integer insertMmCartoonClassificationDic(MmCartoonClassificationDic mmCartoonClassificationDic){
            return mmCartoonClassificationDicMapper.insertMmCartoonClassificationDic(mmCartoonClassificationDic);
    }

    public Integer updateMmCartoonClassificationDic(MmCartoonClassificationDic mmCartoonClassificationDic){
        return mmCartoonClassificationDicMapper.updateMmCartoonClassificationDic(mmCartoonClassificationDic);
    }

    public Integer deleteMmCartoonClassificationDicById(Long id){
        return mmCartoonClassificationDicMapper.deleteMmCartoonClassificationDicById(id);
    }

    public Integer batchDeleteMmCartoonClassificationDic(String ids){
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return mmCartoonClassificationDicMapper.batchDeleteMmCartoonClassificationDic(param);
    }

    public Page<MmCartoonClassificationDic> queryMmCartoonClassificationDicPageByMap(Map<String,Object> param,Integer pageNo,Integer pageSize){
        Integer total = mmCartoonClassificationDicMapper.getMmCartoonClassificationDicCountByMap(param);
        Page page = new Page(pageNo, pageSize, total);
        param.put("beginPos", page.getBeginPos());
        param.put("pageSize", page.getPageSize());
        List<MmCartoonClassificationDic> mmCartoonClassificationDicList = mmCartoonClassificationDicMapper.getMmCartoonClassificationDicListByMap(param);
        page.setList(mmCartoonClassificationDicList);
        return page;
     }


}
